using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cmc.Modbus.Base
{
    public class WriteData
    {
        public string Ip { get; set; }

        public int Port { get; set; }

        public byte StationNumber { get; set; } = 0x01;

        public CommunicationType CommunicationType { get; set; } = CommunicationType.TcpClient;
        public FunctionType FunctionType { get; set; }

        public ModbusCmdType ModbusCmdType { get; set; }

        /// <summary>
        /// 写入对应地址值
        /// </summary>
        public List<AddressWriteValue> WriteDatas { get; set; } = new List<AddressWriteValue>();

        public List<int> AddressesInt
        {
            get
            {
                return WriteDatas.GroupBy(m=>m.Address).Select(m=>m.Key).ToList();
            }
        }

        public  object  Server { get; set; }

    }
}
